﻿using System;
using System.Collections.Generic;
using System.Text;

namespace EFCore.Core.Files
{
    public class FilesActionHandler
    {
        /// <summary>
        /// 根据文件名获取文件扩展名
        /// </summary>
        /// <param name="fileName">文件名称</param>
        /// <returns></returns>
        public static string GetExtension(string fileName)
        {
            if (string.IsNullOrEmpty(fileName))
                return "文件名不能为空";
            else
            {
                int dotPosition = fileName.LastIndexOf('.');
                return fileName.Substring(dotPosition, (fileName.Length - dotPosition));
            }
        }
    }
}
